/**
 * Copyright (c) 2015-2030 by Beijing Yanlight Co., Ltd.
 * All rights reserved.
 */
package com.yanlight.util;

import java.util.UUID;

import com.yanlight.Constants;

/**
 * 
 *
 * @author haolw
 * @time 2017/06/28
 */
public abstract class ToolsUtil {

	/**
	 * 
	 * @param image
	 * @return
	 */
	public static String wrapImage(String image) {
		return Constants.IMGAGE_HOST.concat(image);
	}

	/**
	 * 
	 * @param path
	 * @return
	 */
	public static String wrapApp(String path) {
		return Constants.APP_FILE_HOST.concat(path);
	}

	/**
	 * 创建默认用户名
	 * 
	 * @param mobile
	 * @return
	 */
	public static String createMemberName(String mobile) {
		return mobile.concat("_p");
	}

	public static String createOrderNo() {
		String interference = RandomStringUtil.randomNumeric(8);
		return DateTimeUtil.getCompactMillNowTime().concat(interference);
	}

	public static String uuid() {
		return UUID.randomUUID().toString().replace("-", "");
	}

	/**
	 * 元转换成分
	 * 
	 * @param fee
	 * @return
	 */
	public static Integer convertFee(Double fee) {
		return MathUtil.mul(fee, 100D).intValue();
	}

	/**
	 * 分转换成元
	 * 
	 * @param fee
	 * @return
	 */
	public static Double convertFee(Integer fee) {
		return new Double(fee) / 100;
	}

	/**
	 * 
	 * @param paycode
	 * @return
	 */
	public static String encryptPaycode(String paycode) {
		String value = Constants.TRADE_PAY_HOST.concat(Constants.SLASH).concat(paycode);
		return value;
	}

}
